home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_inf_flywheel.cog < prev    next >
Text File  |  1999-11-15  |  10KB  |  353 lines

  1. # Jones 3D Cog Script
  2. #
  3. # INF_FlyWheel.cog
  4. # Controls the Spinning spoke puzzle wheels
  5. # The correct part is the power part 17 the wrong part is the rumbler 14
  6. # Controls the robot sector thing
  7. #
  8. # [SXC]
  9. #
  10. # (C) 1998 LucasArts Entertainment Co. All Rights Reserved
  11. # ========================================================================================
  12.  
  13. symbols
  14.  
  15.     message     startup
  16.     message     blocked
  17.     message     crossed
  18.     message     pulse
  19.     
  20.     message     user0       # right imp part inserted
  21.     message     user1       # wrong part inserted
  22.     message     user2       # no part inserted
  23.     
  24.     sound       crumble=nub_3mledge_move_c.wav              local
  25.     sound       gearmusic=mus_inf_gearpower.wav             local
  26.     sound       gearspin=inf_piston_2.wav                   local
  27.     sound       gearhits=nub_croc_stop_c.wav                local
  28.     
  29.     cog         lightningcog
  30.     
  31.     cog         elevcog0
  32.     cog         elevcog1
  33.     cog         elevcog2
  34.     cog         elevcog3
  35.     cog         elevcog4
  36.     cog         elevcog5
  37.     cog         elevcog6
  38.     cog         elevcog7
  39.     cog         elevcog8
  40.     
  41.     thing       cam0_pos0
  42.     thing       cam0_tgt1
  43.     
  44.     thing       cam1_pos0
  45.     thing       cam1_tgt0
  46.     
  47.     thing       player                                      local
  48.     thing       actorindy
  49.     
  50.     thing       spoke0
  51.     thing       spoke1
  52.     thing       spoke2
  53.     thing       spoke3
  54.     thing       spoke4
  55.     thing       spoke5
  56.     
  57.     surface     low_entersurf0                              linkid=2
  58.     surface     low_exitsurf1                               linkid=3
  59.     
  60.     surface     hi_entersurf0                               linkid=2
  61.     surface     hi_exitsurf1                                linkid=3
  62.     
  63.     surface     room_entersurf                              linkid=2
  64.     surface     room_exitsurf                               linkid=3
  65.     
  66.     int         solved=0                                    local
  67.     int         num                                         local
  68.     int         toughness_time=1                            local
  69.     int         vibe                                        local
  70.     int         rumblechan                                  local
  71.     
  72.     vector      posOffset                                   local      
  73.     vector      angOffset                                   local
  74.     
  75.  
  76. end
  77.  
  78. code
  79. #........................................................................................
  80. startup:
  81.     
  82.     player = GetLocalPlayerThing();
  83.     //inital conditions
  84.     rotate(spoke0, 30, 2, 1);
  85.     rotate(spoke1, 30, 2, 1);
  86.     rotate(spoke2, 30, 2, 1);
  87.     rotate(spoke3, 60, 2, 1);
  88.     rotate(spoke4, 60, 2, 1);
  89.     rotate(spoke5, 60, 2, 1);
  90.     
  91. return;
  92.  
  93. #........................................................................................
  94. //entering area
  95. crossed:
  96.     
  97.     if ((GetSenderID() == 2) && (solved == 0))
  98.     {
  99.         SetPulse(0.1);
  100.         rumblechan = PlaySoundLocal(crumble, 0.5, 0, 1, 0);
  101.     }
  102.     
  103.     //stop camera shake
  104.     if ((GetSenderID() == 3) && (solved == 0))
  105.     {
  106.         SetPulse(0);
  107.         StopSound(rumblechan, 1);
  108.     }
  109.     
  110. return;
  111.  
  112. #........................................................................................
  113.  
  114. //blocked
  115. blocked:
  116.     //kill indy
  117.     //print("indy is blocking the spokes");
  118. return;
  119.  
  120. #........................................................................................
  121.  
  122. //right part
  123. user0:
  124.  
  125.     //print("The right part has been inserted");
  126.     solved = 1;
  127.     SetPulse(0);
  128.     
  129.     //Start the Cutscene
  130.     StartCutscene(1);
  131.     SendMessage(lightningcog, user0);
  132.     
  133.     SetActorFlags(player, 0x200000);
  134.     StopThing(player);
  135.     SetCameraFocus(2, cam0_pos0);
  136.     SetCameraSecondaryFocus(2, cam0_tgt1);
  137.     SetCurrentCamera(2);
  138.     SetCameraFOV(100, 0, 0);
  139.     
  140.     PlaySoundLocal(gearmusic, 1, 0, 0x0, 0);
  141.     
  142.     //zero out the gears
  143.     PlaySoundThing(gearspin, spoke0, 1, 10, 20, 0x80);
  144.     for(num=0; num<=3; num=num+1)
  145.     {
  146.         Rotate(spoke0[num], -30, 2, 2);
  147.     }
  148.     
  149.     for(num=3; num<=5; num=num+1)
  150.     {
  151.         Rotate(spoke0[num], 30, 2, 2);
  152.     }
  153.     
  154.     WaitForStop(spoke5);
  155.     Sleep(2);
  156.     
  157. #Turning on Camera interps        
  158.     SetCameraLookInterp(2, 1);
  159.     SetCameraPosInterp(2, 1);
  160.     SetCameraInterpSpeed(2, 4);
  161.     Sleep(0.001);
  162.     
  163.     SetCameraFocus(2, cam1_pos0);
  164.     SetCameraSecondaryFocus(2, cam1_tgt0);
  165.         
  166.     //start the rhythmic turning
  167.     if (solved == 1)
  168.     {
  169.         Rotate(spoke5, 90, 2, 2);
  170.         PlaySoundThing(gearspin, spoke5, 1, 2, 10, 0x80);
  171.         Sleep(toughness_time);
  172.         PlaySoundThing(gearhits, spoke5, 1, 10, 20, 0x80);
  173.         if (solved == 0) return;
  174.         
  175.         Rotate(spoke2, -90, 2, 2);
  176.         PlaySoundThing(gearspin, spoke2, 1, 2, 10, 0x80);
  177.         Sleep(toughness_time);
  178.         PlaySoundThing(gearhits, spoke2, 1, 10, 20, 0x80);
  179.         if (solved == 0) return;
  180.         
  181.         Rotate(spoke4, 90, 2, 2);
  182.         PlaySoundThing(gearspin, spoke4, 1, 2, 10, 0x80);
  183.         Sleep(toughness_time);
  184.         PlaySoundThing(gearhits, spoke4, 1, 10, 20, 0x80);
  185.         if (solved == 0) return;
  186.         
  187.         Rotate(spoke1, -90, 2, 2);
  188.         PlaySoundThing(gearspin, spoke1, 1, 2, 10, 0x80);
  189.         Sleep(toughness_time);
  190.         PlaySoundThing(gearspin, spoke1, 1, 2, 10, 0x80);
  191.         if (solved == 0) return;
  192.         
  193.         Rotate(spoke3, 90, 2, 2);
  194.         PlaySoundThing(gearspin, spoke3, 1, 2, 10, 0x80);
  195.         Sleep(toughness_time);
  196.         PlaySoundThing(gearspin, spoke3, 1, 2, 10, 0x80);
  197.         if (solved == 0) return;
  198.         
  199.         Rotate(spoke0, -90, 2, 2);
  200.         PlaySoundThing(gearspin, spoke0, 1, 2, 10, 0x80);
  201.         Sleep(toughness_time);
  202.         PlaySoundThing(gearspin, spoke0, 1, 2, 10, 0x80);
  203.         if (solved == 0) return;
  204.     }
  205.     
  206.     Sleep(1);
  207.     
  208. // Shut off Camera Interps
  209.     SetCameraLookInterp(2, 0);
  210.     SetCameraPosInterp(2, 0);
  211.     SetCameraInterpSpeed(2, 0);
  212.     Sleep(0.01);
  213.             
  214.     CopyOrientAndPos(actorindy, player);
  215.     SetThingFlags(actorindy, 0x80000);
  216.     ClearActorFlags(player, 0x200000);
  217.     ClearThingFlags(player, 0x10);
  218.     ClearThingFlags(player, 0x80000);
  219.     SetCurrentCamera(1);
  220.     SetCameraFOV(90, 0, 0);
  221.     EndCutscene();
  222.     
  223.     //print("IMP3 has been placed");
  224.     SendMessage(elevcog0, user0);
  225.     SendMessage(elevcog1, user0);
  226.     SendMessage(elevcog2, user0);
  227.     SendMessage(elevcog3, user0);
  228.     SendMessage(elevcog4, user0);
  229.     SendMessage(elevcog5, user0);
  230.     SendMessage(elevcog6, user0);
  231.     SendMessage(elevcog7, user0);
  232.     SendMessage(elevcog8, user0);
  233.     
  234.     While (solved == 1)
  235.     {
  236.         Rotate(spoke5, 90, 2, 2);
  237.         PlaySoundThing(gearspin, spoke5, 1, 2, 10, 0x80);
  238.         Sleep(toughness_time);
  239.         PlaySoundThing(gearhits, spoke5, 1, 10, 20, 0x80);
  240.         if (solved == 0) return;
  241.         
  242.         Rotate(spoke2, -90, 2, 2);
  243.         PlaySoundThing(gearspin, spoke2, 1, 2, 10, 0x80);
  244.         Sleep(toughness_time);
  245.         PlaySoundThing(gearhits, spoke2, 1, 10, 20, 0x80);
  246.         if (solved == 0) return;
  247.         
  248.         Rotate(spoke4, 90, 2, 2);
  249.         PlaySoundThing(gearspin, spoke4, 1, 2, 10, 0x80);
  250.         Sleep(toughness_time);
  251.         PlaySoundThing(gearhits, spoke4, 1, 10, 20, 0x80);
  252.         if (solved == 0) return;
  253.         
  254.         Rotate(spoke1, -90, 2, 2);
  255.         PlaySoundThing(gearspin, spoke1, 1, 2, 10, 0x80);
  256.         Sleep(toughness_time);
  257.         PlaySoundThing(gearspin, spoke1, 1, 2, 10, 0x80);
  258.         if (solved == 0) return;
  259.         
  260.         Rotate(spoke3, 90, 2, 2);
  261.         PlaySoundThing(gearspin, spoke3, 1, 2, 10, 0x80);
  262.         Sleep(toughness_time);
  263.         PlaySoundThing(gearspin, spoke3, 1, 2, 10, 0x80);
  264.         if (solved == 0) return;
  265.         
  266.         Rotate(spoke0, -90, 2, 2);
  267.         PlaySoundThing(gearspin, spoke0, 1, 2, 10, 0x80);
  268.         Sleep(toughness_time);
  269.         PlaySoundThing(gearspin, spoke0, 1, 2, 10, 0x80);
  270.         if (solved == 0) return;
  271.     }
  272.     
  273.     
  274.  
  275. return;
  276.  
  277. #........................................................................................
  278. //wrong part
  279. user1:
  280.  
  281.     StartCutscene(1);
  282.     SetActorFlags(player, 0x200000);
  283.     StopThing(player);
  284.     SetCameraFocus(2, cam0_pos0);
  285.     SetCameraSecondaryFocus(2, cam0_tgt1);
  286.     SetCurrentCamera(2);
  287.     SetCameraFOV(100, 0, 0);
  288.     
  289.     solved = 0;
  290.     SetPulse(0.1);
  291.     rumblechan = PlaySoundLocal(crumble, 0.5, 0, 1, 0);
  292.     Sleep(3);
  293.     
  294.     CopyOrientAndPos(actorindy, player);
  295.     SetThingFlags(actorindy, 0x80000);
  296.     ClearActorFlags(player, 0x200000);
  297.     ClearThingFlags(player, 0x10);
  298.     ClearThingFlags(player, 0x80000);
  299.     SetCurrentCamera(1);
  300.     SetCameraFOV(90, 0, 0);
  301.     EndCutscene();
  302.  
  303. return;
  304.  
  305. #........................................................................................
  306. //no part
  307. user2:
  308.  
  309.     //print("part has been removed");
  310.     solved = 2;
  311.     
  312.     //stop the screen shake
  313.     SetPulse(0);
  314.     StopSound(rumblechan, 1);
  315.     
  316. return;
  317.  
  318. #........................................................................................
  319. //screen shake
  320. pulse:
  321.  
  322.     vibe = RandBetween(1, 4);
  323.     if (vibe == 1)
  324.     {
  325.         posOffset = '-0.00125 0.00 -0.0005';
  326.         angOffset = '0.00 -0.001 0.001';
  327.     }
  328.     if (vibe == 2)
  329.     {
  330.         posOffset = '0.00125 -0.00125 0.0005';
  331.         angOffset = '0.001 0.00 -0.001';
  332.     }
  333.     if (vibe == 3)
  334.     {
  335.         posOffset = '0.0005 0.00125 -0.00125';
  336.         angOffset = '-0.001 0.001 -0.001';
  337.     }
  338.     if (vibe == 4)
  339.     {
  340.         posOffset = '-0.001 0.00 0.00125';
  341.         angOffset = '0.00 0.00 0.0005';
  342.     }
  343.  
  344.     SetPOVShake(posOffSet, angOffSet, 50.0, 50.0);
  345.  
  346. return;
  347.  
  348. #........................................................................................
  349.  
  350. end
  351.  
  352.  
  353.